package T13;

import java.util.Scanner;

public class AssembleTriangle {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int [] a = new int[n];
        for(int i = 0;i < n;i ++){
            a[i] = sc.nextInt();
        }
        int cnt = 0;
        for(int i = 0; i < n - 2; ++ i)
            for(int j = i + 1; j < n - 1; ++ j)
                for(int k = j + 1; k < n; ++ k)
                    if(a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i])
                        cnt ++;
        System.out.println(cnt);
    }
}
